import { computed, ref } from 'vue'
import { warnRobotThrottle } from '@src/api/warning'

import PrivateData from './views/PrivateData/index.vue'
import PublicData from './views/PublicData/index.vue'
import MaltData from './views/MaltData/index.vue'

export const tabList = [
  {
    name: 'PublicData',
    label: '储能 公有数据'
  },
  {
    name: 'PrivateData',
    label: '储能 私有数据'
  },
  {
    name: 'MaltData',
    label: '中长期数据'
  }
]

export const useApp = () => {
  const activeName = ref<'PrivateData'|'PublicData' | 'MaltData'>('PublicData')

  const coms:Record<'PrivateData' | 'PublicData' | 'MaltData', any> = {PrivateData, PublicData, MaltData}

  const curCom = computed(() => coms[activeName.value])

  const warnRobotAction = () => {
    warnRobotThrottle()
  }

  return {
    activeName,
    curCom,
    warnRobotAction
  }
}